/*    */ package org.flashzlm.tools.ui;
/*    */ 
/*    */ import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.Graphics;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.util.List;

import javax.swing.JComboBox;
import javax.swing.JPanel;
import javax.swing.JTextField;

import org.flashzlm.tools.analysis.Gua;
/*    */ 
/*    */ public class Dict extends JPanel
/*    */ {
/**
	 * 
	 */
	private static final long serialVersionUID = 3682442564959010247L;
/*    */   private JComboBox shangGuas;
/*    */   private JComboBox xiaGuas;
/*    */   private GuaShape guaShape;
/*    */   private JTextField chongGua;
/*    */   private JTextField guanLianGua;
/*    */ 
/*    */   public Dict()
/*    */   {
/* 29 */     this.shangGuas = new JComboBox();
/* 30 */     this.xiaGuas = new JComboBox();
/* 31 */     this.chongGua = new JTextField(6);
/* 32 */     this.guanLianGua = new JTextField(30);
/* 33 */     this.chongGua.setEditable(false);
/* 34 */     this.guanLianGua.setEditable(false);
/* 35 */     for (String bagua : Gua.baGuas) {
/* 36 */       this.shangGuas.addItem(bagua);
/* 37 */       this.xiaGuas.addItem(bagua);
/*    */     }
/*    */ 
/* 40 */     JPanel up = new JPanel();
/*    */ 
/* 42 */     FlowLayout fl = new FlowLayout();
/* 43 */     fl.setHgap(20);
/* 44 */     fl.setVgap(20);
/* 45 */     up.setLayout(fl);
/* 46 */     up.add(this.shangGuas);
/* 47 */     up.add(this.xiaGuas);
/* 48 */     up.add(this.chongGua);
/*    */ 
/* 50 */     JPanel cen = new JPanel();
/* 51 */     FlowLayout fl1 = new FlowLayout();
/* 52 */     fl.setHgap(20);
/* 53 */     fl.setVgap(20);
/* 54 */     cen.setLayout(fl1);
/* 55 */     cen.add(this.guanLianGua);
/*    */ 
/* 57 */     setLayout(new BorderLayout());
/* 58 */     add(up, "North");
/* 59 */     add(cen, "Center");
/* 60 */     this.guaShape = new GuaShape();
/* 61 */     JPanel center = new JPanel();
/* 62 */     center.setLayout(new GridBagLayout());
/* 63 */     GridBagConstraints cons = new GridBagConstraints();
/* 64 */     cons.gridx = 0;
/* 65 */     cons.gridy = 0;
/* 66 */     cons.gridheight = 1;
/* 67 */     cons.gridwidth = 1;
/* 68 */     cons.ipadx = 60;
/* 69 */     cons.ipady = 120;
/* 70 */     center.add(this.guaShape, cons);
/* 71 */     add(center, "South");
/*    */   }
/*    */ 
/*    */   protected void paintComponent(Graphics g)
/*    */   {
/* 76 */     super.paintComponent(g);
/* 77 */     String sg = ((String)this.shangGuas.getSelectedItem()).substring(0, 1);
/* 78 */     String xg = ((String)this.xiaGuas.getSelectedItem()).substring(0, 1);
/* 79 */     String cgn = Gua.getChongGua(sg + xg);
/* 80 */     this.chongGua.setText(cgn);
/* 81 */     int cgv = Gua.getGuaValue(cgn);
/* 82 */     List<Integer> sixYaos = Gua.getSixYaos(cgv);
/* 83 */     int cuoGv = Gua.cuoGuaValue(sixYaos);
/* 84 */     String cuoGn = (String)Gua.guaValueMap.get(Integer.valueOf(cuoGv));
/* 85 */     int zongGv = Gua.zongGuaValue(sixYaos);
/* 86 */     String zongGn = (String)Gua.guaValueMap.get(Integer.valueOf(zongGv));
/* 87 */     int jiaoHuGv = Gua.jiaoHuGuaValue(sixYaos);
/* 88 */     String jiaoHuGn = (String)Gua.guaValueMap.get(Integer.valueOf(jiaoHuGv));
/* 89 */     this.guanLianGua.setText("       错卦: " + cuoGn + "      综卦: " + zongGn + "     交互卦: " + jiaoHuGn);
/*    */ 
/* 91 */     this.guaShape.setSixYaos(sixYaos);
			 this.guaShape.setCurrYao(6); 	
/* 92 */     this.guaShape.repaint();
/*    */   }
/*    */ }

